package com.kingyun.gpsinspection.purificationservice.services.jsm.outerservice.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.IntDataSrcItemValue;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.Report;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.ReportTotalValue;
import com.kingyun.gpsinspection.purificationservice.facade.model.jsm.Ztree;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.OutReportService;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.reportTemp.JsmReportService;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.reportTemp.JsmReportTempService;
import com.kingyun.gpsinspection.purificationservice.facade.service.jsm.servicenode.JsmServiceNodeService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.HashMap;
import java.util.List;

/**
 * 数据集报表业务接口实现类
 * Created by yangcs on 2017/3/22.
 */

public class OutReportServiceImpl implements OutReportService {

    @Autowired
    private JsmReportTempService reportTempService;
    @Autowired
    private JsmServiceNodeService serviceNodeService;
    @Autowired
    private JsmReportService reportService;

    /**
     * 获取表头
     * @param reportId
     * @return
     */
    @Override
    public JSONArray getHeads(String reportId) {
        return reportTempService.getHeads(null,reportId);
    }

    /**
     * 获取合计
     * @param reportId
     * @return
     */
    @Override
    public JSONArray getSums(String reportId) {
        return reportTempService.getSums(null,reportId);
    }

    /**
     * 获取报表基本信息
     * @param reportId
     * @param editable
     * @return
     */
    @Override
    public JSONObject getInfo(String reportId, boolean editable) {
        return reportTempService.getInfo(null,reportId,null,null,0,editable);
    }

    /**
     * 获取列表数据
     * @param reportId
     * @param remark
     * @return
     */
    @Override
    public JSONArray getData(String reportId, String remark) {
        return reportTempService.getData(null,reportId,remark);
    }

    /**
     * 生产单元树
     * @param keyword
     * @return
     */
    @Override
    public List<Ztree> loadServiceNode(String keyword) {
        return serviceNodeService.getInitZtree(keyword);
    }

    /**
     * 修改报表信息
     * @param report
     * @return
     */
    @Override
    public int saveInfo(Report report) {
        return reportService.saveInfo(report);
    }

    /**
     * 修改整点数据
     * @param value
     * @return
     */
    @Override
    public HashMap saveValue(IntDataSrcItemValue value) {
        return reportService.saveValue(value);
    }

    /**
     * 修改合计数据
     * @param reportTotalValue
     * @return
     */
    @Override
    public int saveSum(ReportTotalValue reportTotalValue, String userId) {
        return reportService.saveSum(reportTotalValue,userId);
    }
}
